package net.uni.ap.exp;

import java.io.PrintStream;
import java.io.PrintWriter;
/**
 * 
 * 处理内容:
 * @version: 1.0
 * @see:net.uni.ap.exp.DAOException.java
 * @date:2012-12-12
 * @author:刘青
 */
public class DAOException extends Exception
{
  private static final long serialVersionUID = 8014536628694723159L;
  private Throwable paramThrowable = null;

  public DAOException()
  {
  }

  public DAOException(String paramString)
  {
    super(paramString);
  }

  public DAOException(Throwable paramThrowable)
  {
    this.paramThrowable = paramThrowable;
  }

  public DAOException(String paramString, Throwable paramThrowable)
  {
    super(paramString);
    this.paramThrowable = paramThrowable;
  }

  public void printStackTrace()
  {
    super.printStackTrace();
    if (this.paramThrowable != null)
      this.paramThrowable.printStackTrace();
  }

  public void printStackTrace(PrintStream paramPrintStream)
  {
    super.printStackTrace(paramPrintStream);
    if (this.paramThrowable != null)
      this.paramThrowable.printStackTrace(paramPrintStream);
  }

  public void printStackTrace(PrintWriter paramPrintWriter)
  {
    super.printStackTrace(paramPrintWriter);
    if (this.paramThrowable != null)
      this.paramThrowable.printStackTrace(paramPrintWriter);
  }
  public String getMessage(){
	 String msg =  super.getMessage();
	 if(null==msg)
		 return null;
		if(msg.indexOf("ORA-20001:")!=-1){
			return msg.substring(msg.indexOf("ORA-20001:")+10,msg.indexOf("\n"));
		}else if(null!=paramThrowable&&null!=paramThrowable.getCause()&&paramThrowable.getCause().toString().indexOf("ORA-20001:")!=-1){
			msg = paramThrowable.getCause().toString();
			return msg.substring(msg.indexOf("ORA-20001:")+10,msg.indexOf("\n"));
		}
		 
	 return msg;
  }
}